<template>
    <div class="insert-btn">
        <el-popover
            placement="right"
            width="200"
            trigger="click">
            <div class="nodeList">
                <div v-for="(item, idx) in list" :key="idx" class="node" @click="addNode(item)">
                    {{ item.name }}
                </div>
            </div>
            <template v-slot:reference>
                <span>+</span>
            </template>
        </el-popover>
    </div>
</template>

<script lang="ts" setup>
let props = defineProps(['nodeConfig']); //数组|对象写法都可以
const list = [
    {
        name: '审批人',
        icon: '',
        type: 'SP'
    },
    {
        name: '抄送人',
        icon: '',
        type: 'CS'
    },
    {
        name: '条件分支',
        icon: '',
        type: 'BRANCH'
    },
]

const addNode = (item) => {
    console.log(props.nodeConfig);
    

}
</script>


<style lang="scss" scoped>
.insert-btn {
    height: 80px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
.nodeList {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    width: 200px;

    .node {
        width: 50%;
        padding: 10px;
    }
}
span {
    display: block;
    position: relative;
    background-color: blue;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    cursor: pointer;

    &::before, &::after {
        content: "";
        position: absolute;
        left: 50%;
        top: -30px;
        width: 0;
        height: 30px;
        border-left: 1px solid #000;
    }
    &::after {
        top: 20px;
    
    }
}
</style>
